<template>
  <div style="padding-bottom:94px;">
    <div v-title>保费报价</div>
    <img src="../image/cxbj.png" style="width:100%;" />
    <div class="box" style="margin-bottom: 60px;">
      <div class="title">
        <div>{{QuoteInfor.InsuranceName}}</div>
      </div>
      <div class="content">
        <div v-if="QuoteInfor.IsMust == 0">交强险+车船使用税<span style="color:#f33e16;">（不参与分期）</span>
          <p>￥{{QuoteInfor.MustMoney}}</p>
        </div>
        <div v-for="item in List">{{item.PolicyName}}<span v-if="item.PolicyTrue == 0"></span>
          <p>￥{{item.PolicyMoney}}</p>
        </div>
      </div>
    </div>
    <div class="bottom">
      <div class="kf" @click="phone">
        <a class="iconfont icon-kefu"></a>
        <p>客服</p>
      </div>
      <div class="total">
        合计金额：<span>￥{{this.QuoteInfor.TotalAmount}}</span>
      </div>
      <div class="next" @click="next()">
        下一步
      </div>
    </div>
  </div>
</template>
<script>
  import api from '../fetch/api.js';
  import { Toast } from 'vant';
  export default {
    data() {
      return {
        QuoteInfor:'',
        List:[]
      }
    },
    created() {
      api.Post('Order/QuoteInfo/GetOneModel', {ID:this.$route.params.id})
      .then(res => {
          this.QuoteInfor = res
          var jason = JSON.parse(res.InsuranceCategory)
          for(var i=0;i<jason.PolicyName.length;i++){
            this.List.push({
              PolicyName:jason.PolicyName[i],
              PolicyMoney:jason.PolicyMoney[i],
              PolicyTrue:jason.PolicyTrue[i],
              PolicyRemark:jason.PolicyRemark[i],
            })
          }
      })
    },
    methods: {
      next() {
        if(this.QuoteInfor.IsOrder == 0){
          Toast.fail('该报价已生成保单!');
          return
        }
        this.$router.push('/InsuranceInfor/' + this.$route.params.id )
      },
      phone(){
          window.location.href = "tel:400-170-1235";
      }
    }
  }

</script>
<style scoped>
  .box {
    width: 94%;
    overflow: hidden;
    margin: auto;
    margin-top: 10px;
    background: #fff;
    border-radius: 3px;
  }

  .title {
    border-bottom: 1px solid #ccc;
    padding: 10px;
  }

  .title div {
    border-left: 3px solid #2491ff;
    padding-left: 7px;
    color: #333;
    font-size: 16px;
    font-weight: bold;
  }

  .content div {
    padding: 10px 0;
    margin: 0 10px;
    color: #333;
    font-size: 14px;
    border-bottom: 1px solid #eee;
  }

  .content p {
    float: right;
    margin: 0;
  }

  .content span {
    color: #999;
  }

  .bottom {
    position: fixed;
    bottom: 0;
    width: 100%;
    overflow: hidden;
    background: #fff;
    height: 60px;
    border-top: 1px solid #eee;
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .kf {
    width: 17%;
    float: left;
    border-right: 1px solid #eee;
    margin-right: -1px;
    text-align: center;
    height:60px;
  }

  .kf a {
    color: #2491ff;
    font-size: 24px;
    margin-top: 10px;
    display: block;
  }

  .kf p {
    margin: 0;
    font-size: 12px;
    color: #666;
  }

  .total {
    width: 50%;
    float: left;
    line-height: 60px;
    text-align: center;
    color: #666666;
    font-size: 14px;
  }

  .total span {
    color: #f33e16;
    font-size: 16px;
  }

  .next {
    width: 33%;
    float: right;
    line-height: 60px;
    background: #2491ff;
    color: #fff;
    text-align: center;
    font-size: 16px;
  }

</style>

<style src="../css/iconfont.css"></style>
